//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet.Data
{
    public class TextConnectionField: IOfficeXmlSerializable
    {
        #region IOfficeXmlSerializable Members

        void IOfficeXmlSerializable.ReadXml(ReadContext context)
        {
            using (ReadContext c = context.Read("textField"))
            {
                Type = c.GetOptionalEnum<ExternalConnectionType>("type", ExternalConnectionType.General);
                Position = c.GetOptionalUIntegerAsInteger("position", 0);
            }
        }

        void IOfficeXmlSerializable.WriteXml(WriteContext context)
        {
            using (WriteContext c = context.Write("textField"))
            {
                c.SetOptionalEnum<ExternalConnectionType>("type", Type, ExternalConnectionType.General);
                c.SetOptionalUIntegerAsInteger("position", Position, 0);
            }
        }

        #endregion
        private int _position;

        public int Position
        {
            get { return _position; }
            set { _position = value; }
        }
	
        private ExternalConnectionType _type;

        public ExternalConnectionType Type
        {
            get { return _type; }
            set { _type = value; }
        }
	
    }
}
